//$URL: http://dasding.googlecode.com/svn/branches/spring-security/demos/jax-rs-springsecurity/src/main/java/de/piratech/jaxrs/security/User.java $
//$Id: User.java 55 2012-10-16 11:57:28Z amuthmann@gmail.com $
package de.piratech.jaxrs.security;

import java.util.HashSet;
import java.util.Set;

/**
 * @author "Animesh Kumar <animesh@strumsoft.com>"
 *
 */
public class User implements java.security.Principal {
  // Role

  public enum Role {

    Admin, User
  };
  private String userId;          // id
  private String name;            // name
  private String emailAddress;    // email
  private Set<Role> roles = new HashSet<Role>();        // roles

  @Override
  public String getName() {
    return null;
  }

  // getters/setters here
  public String getUserId() {
    return userId;
  }

  public void setUserId(String userId) {
    this.userId = userId;
  }

  public String getEmailAddress() {
    return emailAddress;
  }

  public void setEmailAddress(String emailAddress) {
    this.emailAddress = emailAddress;
  }

  public Set<Role> getRoles() {
    return roles;
  }

  public void setRoles(Set<Role> roles) {
    this.roles = roles;
  }
  
  public void addRole(Role role){
    this.roles.add(role);
  }
}
